/**
 * Created with IntelliJ IDEA.
 * Description: Java程序设计面向对象（下）实验代码题目四
 */
interface Animal {
    void sleep();
}

class Cat implements Animal {

    @Override
    public void sleep() {
        System.out.println("猫晚上睡觉");
    }
}

class Pig implements Animal {

    @Override
    public void sleep() {
        System.out.println("猪整天睡觉");
    }
}

public class Example04 {
    public static void main(String[] args) {
        Cat cat = new Cat();
        display(cat);
        Animal pig = new Pig();
        pig.sleep();
    }

    public static void display(Animal animal) {
        animal.sleep();
    }
}
